<?php 
    $image = imageStyle($result->image, 120, 120);
    $url = url('/chi-tiet/'.$result->alias);
    $title = $result->title;
    $urlM = url('main/'.$result->malias);
    $urlC = url('danh-muc/'.$result->calias);
    $mtitle = $result->mtitle;
    $ctitle = $result->ctitle;
 ?>

<div class="bgTop bgTopNone">
            <h2 class="breadcrumb">
            	<a href="/">Tài liệu</a> > <a href="<?php echo $urlM ?>"><?php echo $mtitle ?></a> > <a class="active" href="<?php echo $urlC ?>"><?php echo $ctitle ?> </a>
            </h2>    
            <div class="contentx">
                <h2><?php echo $title ?></h2>
                
                <p><?php echo $result->summary ?></p>   
                
            </div>
            <div id="documentViewer" class="flexpaper_viewer" style="width:625px; height:550px"></div>
<script type="text/javascript">
    function getDocumentUrl(document){
        return "php/services/view.php?doc={doc}&format={format}&page={page}".replace("{doc}",document);
    }

    var startDocument = "Paper";

    jQuery('#documentViewer').FlexPaperViewer(
            { config : {

                SWFFile : '<?php echo iUrlFile($result->swf_file) ?>',

                Scale : 0.6,
                ZoomTransition : 'easeOut',
                ZoomTime : 0.5,
                ZoomInterval : 0.2,
                FitPageOnLoad : true,
                FitWidthOnLoad : false,
                FullScreenAsMaxWindow : false,
                ProgressiveLoading : false,
                MinZoomSize : 0.2,
                MaxZoomSize : 5,
                SearchMatchAll : false,
                InitViewMode : 'Portrait',
                RenderingOrder : 'flash,html',
                StartAtPage : '',
                ViewModeToolsVisible : true,
                ZoomToolsVisible : true,
                NavToolsVisible : true,
                CursorToolsVisible : true,
                SearchToolsVisible : true,
                WMode : 'window',
                localeChain: 'en_US'
            }}
    );
</script>
            <?php 
                 $fileInfo = swf_fileinfo($result->doc_file); 
                 $docType = get_mime_by_extension(basename($fileInfo['name']));
                
             ?>
        <div style="border:#ccc 1px solid; margin-top: 10px; padding-left: 10px;">
            <p>Loại file: <?php echo $docType ?></p>
            <p> 
                <span>Kích thước  <?php echo round($fileInfo['size'] / 1000000, 2) ?> Mb 
                <span style="margin-left: 10px;"> Số Trang <?php echo $result->numpage ?></span>  
            </p>
            <p> 
                Tags: <?php
                foreach ($tags as $tag) {
                        $url = url('tags/'.$tag->id.'/'.$tag->tags);
                    ?>
                    <a href="<?php echo $url ?>"><?php echo $tag->tags ?></a> &nbsp; 
                    <?php
                }
                    
                  ?> 
            </p>
        </div>
<?php 
if ($this->session->userdata('login')) {
 ?>        
        <div class="btnsend" style="margin-top: 20px;">
            <input type="button" value="Download" id="btnDownload" class="btnComment" 
                name="btnDownload" style="height: 30px; cursor: pointer;" onclick="window.location='/docs/download/<?php echo $result->id ?>'" />    
        </div>  
<?php 
}
 ?>          
</div>  